import request from '@/utils/request'

/**
 * 新增项目
 */
export function addProject(data) {
  return request({
    url: '/project/addProject',
    method: 'post',
    data
  })
}

/**
 * 新增项目
 */
export function updateProject(data) {
  return request({
    url: '/project/updateProject',
    method: 'post',
    data
  })
}

/**
 * 通过项目邀请码加入项目
 */
export function joinProject(data) {
  return request({
    url: '/project/joinProject',
    method: 'post',
    data
  })
}

/**
 * 查询用户所有项目
 */
export function getProjectsByUserId(id,params) {
  return request({
    url: `/project/getProjectsByUserId/${id}`,
    method: 'post',
    data:params
  })
}

/**
 * 根据项目状态查询用户项目
 */
export function getProjectsByCondition(id,params,project) {
  return request({
    url: `/project/getProjectsByCondition/${id}`,
    method: 'post',
    data: {
      "page":params,
      "project":project
    }
  })
}

/**
 * 根据项目id和用户id查询一个项目的具体信息
 */
export function getProjectByProjectIdAndUserId(params) {
  return request({
    url: `/project/getProjectByProjectIdAndUserId`,
    method: 'post',
    data: params
  })
}

/**
 * 获取项目邀请码
 */
export function getProjectInvitCode(params) {
  return request({
    url: `/project/getProjectInvitCode`,
    method: 'post',
    data: params
  })
}

/**
 * 项目结项
 */
 export function projectKnot(params) {
  return request({
    url: `/project/projectKnot`,
    method: 'post',
    data: params
  })
}
